package com.scope;

import com.alibaba.fastjson.JSON;
import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.Method;

public class TestMain {
    public static void main(String[] args) throws Exception {
        UserInfo userInfo = new UserInfo();
        userInfo.setUserId("123");
        userInfo.setUserName("vector");

        // compile  编译，运行，打包
        System.out.println(JSON.toJSONString(userInfo));

        //
        Object o = BeanUtils.cloneBean(userInfo);
        System.out.println(JSON.toJSONString(o));

        Class<?> aClass = Class.forName("cn.hutool.json.JSONUtil");
        Method formatJsonStr = aClass.getMethod("formatJsonStr",String.class);

        System.out.println(formatJsonStr.invoke(aClass, "{'key':'haha'}"));
    }
}